/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package bpel2rep.version.state.impl;

import bpel2rep.process.ProcessPackage;

import bpel2rep.process.impl.ProcessPackageImpl;

import bpel2rep.version.VersionPackage;

import bpel2rep.version.impl.VersionPackageImpl;

import bpel2rep.version.state.Free;
import bpel2rep.version.state.Initial;
import bpel2rep.version.state.LockUse;
import bpel2rep.version.state.LockWork;
import bpel2rep.version.state.SimuleSession;
import bpel2rep.version.state.StateFactory;
import bpel2rep.version.state.StatePackage;

import bpel2rep.version.store.StorePackage;

import bpel2rep.version.store.impl.StorePackageImpl;

import executable.ExecutablePackage;

import executable.impl.ExecutablePackageImpl;

import namespace.NamespacePackage;

import namespace.impl.NamespacePackageImpl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class StatePackageImpl extends EPackageImpl implements StatePackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass lockUseEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass lockWorkEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass simuleSessionEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass freeEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass initialEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see bpel2rep.version.state.StatePackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private StatePackageImpl() {
		super(eNS_URI, StateFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this
	 * model, and for any others upon which it depends.  Simple
	 * dependencies are satisfied by calling this method on all
	 * dependent packages before doing anything else.  This method drives
	 * initialization for interdependent packages directly, in parallel
	 * with this package, itself.
	 * <p>Of this package and its interdependencies, all packages which
	 * have not yet been registered by their URI values are first created
	 * and registered.  The packages are then initialized in two steps:
	 * meta-model objects for all of the packages are created before any
	 * are initialized, since one package's meta-model objects may refer to
	 * those of another.
	 * <p>Invocation of this method will not affect any packages that have
	 * already been initialized.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static StatePackage init() {
		if (isInited) return (StatePackage)EPackage.Registry.INSTANCE.getEPackage(StatePackage.eNS_URI);

		// Obtain or create and register package
		StatePackageImpl theStatePackage = (StatePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof StatePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new StatePackageImpl());

		isInited = true;

		// Obtain or create and register interdependencies
		VersionPackageImpl theVersionPackage = (VersionPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(VersionPackage.eNS_URI) instanceof VersionPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(VersionPackage.eNS_URI) : VersionPackage.eINSTANCE);
		StorePackageImpl theStorePackage = (StorePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI) instanceof StorePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI) : StorePackage.eINSTANCE);
		ProcessPackageImpl theProcessPackage = (ProcessPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ProcessPackage.eNS_URI) instanceof ProcessPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ProcessPackage.eNS_URI) : ProcessPackage.eINSTANCE);
		ExecutablePackageImpl theExecutablePackage = (ExecutablePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ExecutablePackage.eNS_URI) instanceof ExecutablePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ExecutablePackage.eNS_URI) : ExecutablePackage.eINSTANCE);
		NamespacePackageImpl theNamespacePackage = (NamespacePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(NamespacePackage.eNS_URI) instanceof NamespacePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(NamespacePackage.eNS_URI) : NamespacePackage.eINSTANCE);

		// Load packages
		theExecutablePackage.loadPackage();

		// Create package meta-data objects
		theStatePackage.createPackageContents();
		theVersionPackage.createPackageContents();
		theStorePackage.createPackageContents();
		theProcessPackage.createPackageContents();
		theNamespacePackage.createPackageContents();

		// Initialize created meta-data
		theStatePackage.initializePackageContents();
		theVersionPackage.initializePackageContents();
		theStorePackage.initializePackageContents();
		theProcessPackage.initializePackageContents();
		theNamespacePackage.initializePackageContents();

		// Fix loaded packages
		theExecutablePackage.fixPackageContents();

		// Mark meta-data to indicate it can't be changed
		theStatePackage.freeze();

		return theStatePackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getLockUse() {
		return lockUseEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getLockWork() {
		return lockWorkEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getSimuleSession() {
		return simuleSessionEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getFree() {
		return freeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getInitial() {
		return initialEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StateFactory getStateFactory() {
		return (StateFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		lockUseEClass = createEClass(LOCK_USE);

		lockWorkEClass = createEClass(LOCK_WORK);

		simuleSessionEClass = createEClass(SIMULE_SESSION);

		freeEClass = createEClass(FREE);

		initialEClass = createEClass(INITIAL);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		VersionPackage theVersionPackage = (VersionPackage)EPackage.Registry.INSTANCE.getEPackage(VersionPackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		lockUseEClass.getESuperTypes().add(theVersionPackage.getVersionState());
		lockWorkEClass.getESuperTypes().add(theVersionPackage.getVersionState());
		simuleSessionEClass.getESuperTypes().add(theVersionPackage.getVersionState());
		freeEClass.getESuperTypes().add(theVersionPackage.getVersionState());
		initialEClass.getESuperTypes().add(theVersionPackage.getVersionState());

		// Initialize classes and features; add operations and parameters
		initEClass(lockUseEClass, LockUse.class, "LockUse", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(lockWorkEClass, LockWork.class, "LockWork", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(simuleSessionEClass, SimuleSession.class, "SimuleSession", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(freeEClass, Free.class, "Free", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		initEClass(initialEClass, Initial.class, "Initial", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
	}

} //StatePackageImpl
